home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / TroyReturns.dxr / 00009_Monster handlers.ls < prev    next >
Encoding:
Text File  |  2002-01-31  |  34.4 KB  |  824 lines

  1. global monsterSO, monsterData, playerViewpoint
  2.  
  3. on initializeMonsters
  4.   monsterData = []
  5.   repeat with wMonster = 1 to 25
  6.     wSprite = monsterSO + wMonster
  7.     puppetSprite(wSprite, 1)
  8.     sprite(wSprite).visible = 0
  9.     set the member of sprite wSprite to "Teeth 1"
  10.     set the ink of sprite wSprite to 36
  11.     set the loc of sprite wSprite to point(-50, -50)
  12.     add(monsterData, [0, 0, point(0, 0), []])
  13.   end repeat
  14. end
  15.  
  16. on addMonster spawnType, spawnLoc, spawnParameters, spawnVariation
  17.   validSlot = 0
  18.   repeat with wSlot = 1 to count(monsterData)
  19.     if (monsterData[wSlot][1] = 0) and (validSlot = 0) then
  20.       validSlot = wSlot
  21.     end if
  22.   end repeat
  23.   if validSlot <> 0 then
  24.     wSprite = monsterSO + validSlot
  25.     monsterData[validSlot] = [1, spawnType, spawnLoc, spawnParameters, 0, spawnVariation]
  26.     sprite(wSprite).visible = 1
  27.   end if
  28. end
  29.  
  30. on initializeBossMonster
  31.   global bossHitArea, bossHarmArea, bossData
  32.   bossHitArea = []
  33.   bossHarmArea = []
  34.   bossData = [1, point(500, 500), 1, [point(0, 0), 0, 0, 0]]
  35.   set the member of sprite 21 to "Fish Boss Normal"
  36.   set the foreColor of sprite 21 to 255
  37.   set the loc of sprite 21 to point(290, 600)
  38. end
  39.  
  40. on moveBossMonster bossState
  41.   global bossHitArea, bossHarmArea, bossData, playerLocData, screenShakeValue, rumbleOffset, bossIntro, eyeRoll, bossHealth, bossDamageTaken, hitIndicatorDelay, hitIndicatorLength
  42.   hitDamage = 10
  43.   if bossHealth <= 0 then
  44.     bossData[3] = 7
  45.   end if
  46.   if bossState = 1 then
  47.     harmless = 0
  48.     case bossData[3] of
  49.       1:
  50.         if bossData[2][2] > 500 then
  51.           bossData[2][2] = bossData[2][2] - 4
  52.         end if
  53.         if bossData[2][1] < playerLocData[3][1] then
  54.           bossData[4][1][1] = bossData[4][1][1] + 0.20000000000000001
  55.           if bossData[4][1][1] > 20 then
  56.             bossData[4][1][1] = 20
  57.           end if
  58.           leapSpeed = 10
  59.           sprite(21).flipH = 0
  60.         else
  61.           bossData[4][1][1] = bossData[4][1][1] - 0.20000000000000001
  62.           if bossData[4][1][1] < -20 then
  63.             bossData[4][1][1] = -20
  64.           end if
  65.           leapSpeed = -10
  66.           sprite(21).flipH = 1
  67.         end if
  68.         bossData[2] = bossData[2] + bossData[4][1]
  69.         bossData[4][2] = bossData[4][2] + 1
  70.         if bossData[4][2] >= 65 then
  71.           if abs(abs(bossData[2][1]) - abs(playerLocData[3][1])) <= 250 then
  72.             if bossIntro > 0 then
  73.               bossData[3] = 3
  74.             else
  75.               bossData[3] = 1 + random(2)
  76.             end if
  77.             bossData[4][1][2] = -30
  78.             bossData[4][1][1] = leapSpeed
  79.           end if
  80.         end if
  81.       2:
  82.         bossData[4][1] = bossData[4][1] + point(0, 1)
  83.         fishRotate = findAngle(point(0, 0), bossData[4][1])
  84.         if bossData[4][1][2] < 0 then
  85.           if bossData[4][1][1] > 0 then
  86.             sprite(21).rotation = fishRotate - 90
  87.           else
  88.             sprite(21).rotation = fishRotate + 90
  89.           end if
  90.         else
  91.           sprite(21).rotation = 0
  92.         end if
  93.         solidTest = checkSolidpoint(bossData[2] + point(0, 90))
  94.         if bossData[2][2] > 500 then
  95.           bossData[3] = 1
  96.           screenShakeValue = 20
  97.           playSound("Small Bomb SFX")
  98.           bossData[4][3] = 0
  99.           bossData[4][4] = 0
  100.         else
  101.           if (solidTest[1] = 1) and (bossData[4][1][2] > 0) then
  102.             bossData[3] = 4
  103.             screenShakeValue = 20
  104.             bossData[4][3] = 0
  105.             bossData[4][4] = 5
  106.             playSound("Small Bomb SFX")
  107.           else
  108.             bossData[2] = bossData[2] + bossData[4][1]
  109.           end if
  110.         end if
  111.       3:
  112.         bossData[2] = bossData[2] + bossData[4][1]
  113.         bossData[4][1] = bossData[4][1] + point(0, 1)
  114.         fishRotate = findAngle(point(0, 0), bossData[4][1])
  115.         if bossData[4][1][1] < 0 then
  116.           sprite(21).rotation = fishRotate + 90
  117.         else
  118.           sprite(21).rotation = fishRotate - 90
  119.         end if
  120.         solidTest = checkSolidpoint(bossData[2] + point(0, 110))
  121.         if bossData[2][2] > 650 then
  122.           bossData[2][2] = 650
  123.           bossData[3] = 1
  124.           bossData[4][2] = 0
  125.           bossData[4][1][2] = 0
  126.           screenShakeValue = 20
  127.           playSound("Small Bomb SFX")
  128.           sprite(21).rotation = 0
  129.         end if
  130.       4:
  131.         bossData[4][3] = bossData[4][3] + 1
  132.         if (bossData[4][3] mod 20) = 0 then
  133.           set the member of sprite 21 to "Fish Boss Normal"
  134.         else
  135.           if (bossData[4][3] mod 20) = 15 then
  136.             if bossData[4][4] > 0 then
  137.               set the member of sprite 21 to "Fish Boss Burp"
  138.               if bossData[4][1][1] > 0 then
  139.                 spawnoffset = bossData[2] + point(80, 15)
  140.                 addMonster(1, spawnoffset, [point(6, random(3) - 2), point(0, 120), point(0, 0), 1], 2)
  141.               else
  142.                 spawnoffset = bossData[2] + point(-80, 15)
  143.                 addMonster(1, spawnoffset, [point(-6, random(3) - 2), point(0, 120), point(0, 0), 1], 2)
  144.               end if
  145.               bossData[4][4] = bossData[4][4] - 1
  146.             else
  147.               bossData[3] = 5
  148.               bossData[4][1][2] = 0
  149.             end if
  150.           end if
  151.         end if
  152.         hitDamage = 20
  153.       5:
  154.         bossData[4][1][2] = bossData[4][1][2] + 1
  155.         if bossData[4][1][2] > 30 then
  156.           bossData[4][1][2] = 30
  157.         end if
  158.         bossData[2][2] = bossData[2][2] + bossData[4][1][2]
  159.         if bossData[2][2] > 650 then
  160.           bossData[2][2] = 650
  161.           bossData[3] = 1
  162.           bossData[4][2] = 0
  163.           bossData[4][1][2] = 0
  164.         end if
  165.       6:
  166.         bossData[4][1][2] = bossData[4][1][2] + 0.5
  167.         if bossData[4][1][2] > 30 then
  168.           bossData[4][1][2] = 30
  169.         end if
  170.         bossData[2][2] = bossData[2][2] + bossData[4][1][2]
  171.         if bossData[2][2] > 650 then
  172.           bossData[2][2] = 650
  173.           bossData[3] = 1
  174.           bossData[4][2] = 0
  175.           bossData[4][1][2] = 0
  176.         end if
  177.         eyeRoll = eyeRoll + 25
  178.         hitDamage = 0
  179.       7:
  180.         if bossData[4][1][2] < 6 then
  181.           bossData[4][1][2] = bossData[4][1][2] + 0.10000000000000001
  182.         end if
  183.         if bossData[4][1][2] > 30 then
  184.           bossData[4][1][2] = 30
  185.         end if
  186.         bossData[2][2] = bossData[2][2] + bossData[4][1][2]
  187.         if bossData[2][2] > 650 then
  188.           bossData[2][2] = 650
  189.           bossData[3] = 1
  190.           bossData[4][2] = 0
  191.           bossData[4][1][2] = 0
  192.           go(35)
  193.         end if
  194.         spawnPoint = bossData[2] + point(random(350) - 175, random(150) - 75)
  195.         addparticle(spawnPoint, 0, 1)
  196.         set the foreColor of sprite 21 to random(255)
  197.         eyeRoll = eyeRoll + 25
  198.         hitDamage = 0
  199.         harmless = 1
  200.     end case
  201.     if playerLocData[6] = #Crouch then
  202.       sprite(19).locZ = -10
  203.       set the loc of sprite 19 to playerLocData[3] - playerViewpoint + rumbleOffset + point(0, 25)
  204.       set the height of sprite 19 to 25
  205.     else
  206.       set the loc of sprite 19 to playerLocData[3] - playerViewpoint + rumbleOffset
  207.       set the height of sprite 19 to 75
  208.     end if
  209.     set the loc of sprite 18 to playerLocData[3] - playerViewpoint + rumbleOffset + point(0, 50)
  210.     bossDamageTaken = 0
  211.     if sprite 19 intersects sprite(21) then
  212.       if playerLocData[1] = 1 then
  213.         bossDamageTaken = 1
  214.       end if
  215.     else
  216.       if sprite 18 intersects sprite(20) and (harmless = 0) then
  217.         playerLocData[5] = -45
  218.         playerLocData[2] = 0
  219.         bossData[3] = 6
  220.         bossData[4][1][2] = 0
  221.         bossHealth = bossHealth - hitDamage
  222.         if hitDamage > 0 then
  223.           hitIndicatorDelay = 30
  224.           hitIndicatorLength = hitDamage * 3
  225.           addScore(hitDamage * 10)
  226.           playSound("Boss Hit SFX")
  227.         end if
  228.       end if
  229.     end if
  230.     set the loc of sprite 21 to bossData[2] - playerViewpoint + rumbleOffset
  231.     set the loc of sprite 20 to bossData[2] - playerViewpoint + rumbleOffset
  232.     sprite(20).rotation = sprite(21).rotation
  233.     sprite(20).flipH = sprite(21).flipH
  234.     sprite(20).visible = 1
  235.     sprite(21).visible = 1
  236.     sprite(22).visible = 1
  237.     case sprite(20).flipH of
  238.       0:
  239.         eyeCenterAim = 123 - sprite(20).rotation
  240.       1:
  241.         eyeCenterAim = 123 + sprite(20).rotation
  242.     end case
  243.     locY = integer(cos(eyeCenterAim * PI / 180) * 113)
  244.     locX = integer(sin(eyeCenterAim * PI / 180) * 113)
  245.     case sprite(20).flipH of
  246.       0:
  247.         locX = locX
  248.       1:
  249.         locX = 0 - locX
  250.     end case
  251.     fishSocketLocation = bossData[2] - playerViewpoint + rumbleOffset + point(locX, locY)
  252.     playerDrawLocation = playerLocData[3] - playerViewpoint + rumbleOffset
  253.     if bossData[3] <> 6 then
  254.       lookingAtYouAim = findAngle(fishSocketLocation, playerDrawLocation)
  255.       set the member of sprite 20 to "Giant Fin"
  256.     else
  257.       lookingAtYouAim = eyeRoll mod 360
  258.       if (eyeRoll mod 2) = 0 then
  259.         set the member of sprite 20 to "Giant Fin Hurt"
  260.       else
  261.         set the member of sprite 20 to "Giant Fin"
  262.       end if
  263.     end if
  264.     locY2 = integer(cos(lookingAtYouAim * PI / 180) * -10)
  265.     locX2 = integer(sin(lookingAtYouAim * PI / 180) * 10)
  266.     set the loc of sprite 22 to fishSocketLocation + point(locX2, locY2)
  267.     if bossHealth < 0 then
  268.       bossHealth = 0
  269.     end if
  270.     set the width of sprite 24 to bossHealth * 3
  271.   else
  272.     sprite(21).visible = 0
  273.   end if
  274.   indicatorOffset = point(155, 10)
  275.   set the loc of sprite 23 to indicatorOffset + rumbleOffset
  276.   set the loc of sprite 24 to indicatorOffset + rumbleOffset + point(0, 5)
  277.   set the loc of sprite 25 to indicatorOffset + rumbleOffset + point(the width of sprite 24, 5)
  278.   set the loc of sprite 26 to point(322, 35) + rumbleOffset
  279.   if hitIndicatorDelay > 0 then
  280.     hitIndicatorDelay = hitIndicatorDelay - 1
  281.     set the width of sprite 25 to hitIndicatorLength
  282.   else
  283.     if hitIndicatorLength > 0 then
  284.       hitIndicatorLength = hitIndicatorLength - 1
  285.       set the width of sprite 25 to hitIndicatorLength
  286.     end if
  287.   end if
  288. end
  289.  
  290. on moveMonsters
  291.   global monsterHitArea, monsterHarmArea, playerLocData, rumbleOffset, screenTileSize
  292.   monsterHitArea = []
  293.   monsterHarmArea = []
  294.   repeat with wMonster = 1 to count(monsterData)
  295.     wSprite = monsterSO + wMonster
  296.     if monsterData[wMonster][1] = 1 then
  297.       if findDistance(playerViewpoint + point(290, 220), monsterData[wMonster][3]) <= 600 then
  298.         case monsterData[wMonster][2] of
  299.           1:
  300.             curLoc = monsterData[wMonster][3]
  301.             solidTestA = checkSolidpoint(curLoc + point(15, 0))
  302.             solidTestB = checkSolidpoint(curLoc - point(15, 0))
  303.             if (solidTestA[1] <> 1) or (solidTestB[1] <> 1) then
  304.               curLoc = monsterData[wMonster][3]
  305.               moveSpeed = monsterData[wMonster][4][1]
  306.               if moveSpeed[1] > 0 then
  307.                 solidTest = checkSolidpoint(curLoc + point(15, 0))
  308.                 killtest = checkSolidpoint(curLoc - point(15, 0))
  309.                 if solidTest[1] = 1 then
  310.                   if killtest[1] = 1 then
  311.                     deleteEnemy = 1
  312.                   else
  313.                     monsterData[wMonster][4][1][1] = 0 - abs(moveSpeed[1])
  314.                   end if
  315.                 end if
  316.                 monsterFlip = 1
  317.               else
  318.                 if moveSpeed[1] < 0 then
  319.                   solidTest = checkSolidpoint(curLoc - point(15, 0))
  320.                   killtest = checkSolidpoint(curLoc + point(15, 0))
  321.                   if solidTest[1] = 1 then
  322.                     if killtest[1] = 1 then
  323.                       deleteEnemy = 1
  324.                     else
  325.                       monsterData[wMonster][4][1][1] = abs(moveSpeed[1])
  326.                     end if
  327.                   end if
  328.                   monsterFlip = 0
  329.                 end if
  330.               end if
  331.               moveSpeed[2] = 0
  332.               driftSpd = monsterData[wMonster][4][2]
  333.               driftMoment = monsterData[wMonster][4][3]
  334.               repeat with wvect = 1 to 2
  335.                 if driftSpd[wvect] > 0 then
  336.                   driftMoment[wvect] = driftMoment[wvect] - 1
  337.                   next repeat
  338.                 end if
  339.                 driftMoment[wvect] = driftMoment[wvect] + 1
  340.               end repeat
  341.               driftSpd = driftSpd + driftMoment
  342.               monsterData[wMonster][4][2] = driftSpd
  343.               monsterData[wMonster][4][3] = driftMoment
  344.               monsterData[wMonster][3] = monsterData[wMonster][3] + moveSpeed
  345.               deleteEnemy = 0
  346.               if findDistance(playerViewpoint + point(290, 220), monsterData[wMonster][3]) >= 500 then
  347.                 if monsterData[wMonster][6] = 2 then
  348.                   deleteEnemy = 1
  349.                 end if
  350.               end if
  351.               if monsterData[wMonster][5] >= 1 then
  352.                 addScore(30)
  353.                 set the loc of sprite (monsterSO + wMonster) to point(-50, -50)
  354.                 rpoint = monsterData[wMonster][3]
  355.                 addparticle(rpoint, 0, 1)
  356.                 monsterData[wMonster][1] = 0
  357.                 repeat with wCoin = 1 to 1
  358.                   addPickup(1, 1, monsterData[wMonster][3], point([-3, 0, 3][wCoin], 5 - random(3)))
  359.                 end repeat
  360.               else
  361.                 if deleteEnemy = 1 then
  362.                   set the loc of sprite (monsterSO + wMonster) to point(-50, -50)
  363.                   monsterData[wMonster][1] = 0
  364.                 else
  365.                   monsterData[wMonster][4][4] = monsterData[wMonster][4][4] + 1
  366.                   if monsterData[wMonster][4][4] > 2 then
  367.                     monsterData[wMonster][4][4] = 1
  368.                   end if
  369.                   set the member of sprite wSprite to "teeth" & " " & string(monsterData[wMonster][4][4])
  370.                   set the loc of sprite wSprite to monsterData[wMonster][3] - playerViewpoint + rumbleOffset
  371.                   sprite(wSprite).flipH = monsterFlip
  372.                   curLoc = monsterData[wMonster][3]
  373.                   add(monsterHitArea, rect(curLoc[1] - 25, curLoc[2] - 25, curLoc[1] + 25, curLoc[2] + 25))
  374.                   add(monsterHarmArea, rect(curLoc[1] - 15, curLoc[2] - 15, curLoc[1] + 15, curLoc[2] + 20))
  375.                 end if
  376.               end if
  377.             else
  378.               set the loc of sprite (monsterSO + wMonster) to point(-50, -50)
  379.               monsterData[wMonster][1] = 0
  380.             end if
  381.           2:
  382.             monsterData[wMonster][4][1] = monsterData[wMonster][4][1] + monsterData[wMonster][4][2]
  383.             curLoc = monsterData[wMonster][3]
  384.             solidTest = checkSolidpoint(curLoc)
  385.             locY = integer(cos(monsterData[wMonster][4][1] * PI / 180) * -70)
  386.             locX = integer(sin(monsterData[wMonster][4][1] * PI / 180) * 70)
  387.             boomloc = monsterData[wMonster][3] + point(locX, locY)
  388.             if solidTest[1] = 0 then
  389.               addScore(60)
  390.               monsterData[wMonster][1] = 0
  391.               set the loc of sprite wSprite to point(-50, -50)
  392.               set the member of sprite wSprite to "Void Block"
  393.               sprite(wSprite).rotation = 0
  394.               addparticle(boomloc, 0, 1)
  395.               repeat with wCoin = 1 to 1
  396.                 addPickup(1, 1, monsterData[wMonster][3], point([-3, 0, 3][wCoin], 5 - random(3)))
  397.               end repeat
  398.             else
  399.               set the loc of sprite wSprite to monsterData[wMonster][3] - playerViewpoint + rumbleOffset
  400.               set the member of sprite wSprite to "Spinning eye"
  401.               sprite(wSprite).rotation = monsterData[wMonster][4][1]
  402.             end if
  403.             curLoc = boomloc
  404.             add(monsterHitArea, rect(0, 0, 0, 0))
  405.             add(monsterHarmArea, rect(curLoc[1] - 10, curLoc[2] - 10, curLoc[1] + 10, curLoc[2] + 10))
  406.           3:
  407.             curLoc = monsterData[wMonster][3]
  408.             moveSpeed = monsterData[wMonster][4][1]
  409.             if moveSpeed[1] > 0 then
  410.               solidTest = checkSolidpoint(curLoc + point(15, 0))
  411.               if solidTest[1] = 1 then
  412.                 monsterData[wMonster][4][1][1] = 0 - abs(moveSpeed[1])
  413.               end if
  414.               monsterFlip = 1
  415.             else
  416.               if moveSpeed[1] < 0 then
  417.                 solidTest = checkSolidpoint(curLoc - point(15, 0))
  418.                 if solidTest[1] = 1 then
  419.                   monsterData[wMonster][4][1][1] = abs(moveSpeed[1])
  420.                 end if
  421.                 monsterFlip = 0
  422.               end if
  423.             end if
  424.             if moveSpeed[2] > 0 then
  425.               solidTest = checkSolidpoint(curLoc + point(0, 15))
  426.               if solidTest[1] = 1 then
  427.                 monsterData[wMonster][4][1][2] = 0 - abs(moveSpeed[2])
  428.               end if
  429.             else
  430.               if moveSpeed[2] < 0 then
  431.                 solidTest = checkSolidpoint(curLoc - point(0, 15))
  432.                 if solidTest[1] = 1 then
  433.                   monsterData[wMonster][4][1][2] = abs(moveSpeed[2])
  434.                 end if
  435.               end if
  436.             end if
  437.             monsterData[wMonster][3] = monsterData[wMonster][3] + moveSpeed
  438.             if monsterData[wMonster][5] >= 1 then
  439.               addScore(45)
  440.               set the loc of sprite (monsterSO + wMonster) to point(-50, -50)
  441.               rpoint = monsterData[wMonster][3]
  442.               addparticle(rpoint, 0, 1)
  443.               monsterData[wMonster][1] = 0
  444.               repeat with wCoin = 1 to 1
  445.                 addPickup(1, 1, monsterData[wMonster][3], point([-3, 0, 3][wCoin], 5 - random(3)))
  446.               end repeat
  447.             else
  448.               monsterData[wMonster][4][4] = monsterData[wMonster][4][4] + 1
  449.               if monsterData[wMonster][4][4] > 2 then
  450.                 monsterData[wMonster][4][4] = 1
  451.               end if
  452.               set the member of sprite wSprite to "Rolling Eye"
  453.               sprite(wSprite).rotation = monsterData[wMonster][3][1] mod 360
  454.               set the loc of sprite wSprite to monsterData[wMonster][3] - playerViewpoint + rumbleOffset
  455.               curLoc = monsterData[wMonster][3]
  456.               add(monsterHitArea, rect(curLoc[1] - 25, curLoc[2] - 25, curLoc[1] + 25, curLoc[2] + 25))
  457.               add(monsterHarmArea, rect(curLoc[1] - 15, curLoc[2] - 15, curLoc[1] + 15, curLoc[2] + 15))
  458.             end if
  459.           4:
  460.             case monsterData[wMonster][6] of
  461.               1:
  462.                 monName1 = "FallingRat"
  463.                 monName2 = "Rat"
  464.                 spawnedMinion = 1
  465.                 jumpCliffs = 1
  466.               2:
  467.                 monName1 = "NewTiny"
  468.                 monName2 = "NewTiny"
  469.                 spawnedMinion = 0
  470.                 jumpCliffs = 0
  471.             end case
  472.             curLoc = monsterData[wMonster][3]
  473.             moveSpeed = monsterData[wMonster][4][1]
  474.             floorTest = checkSolidpoint(curLoc + point(0, 25))
  475.             if floorTest[1] = 0 then
  476.               monsterData[wMonster][4][4] = monsterData[wMonster][4][4] + 1
  477.               if monsterData[wMonster][4][4] > 9 then
  478.                 monsterData[wMonster][4][4] = 1
  479.               end if
  480.               if monsterData[wMonster][4][4] > 6 then
  481.                 set the member of sprite wSprite to monName1 & "1"
  482.               else
  483.                 if monsterData[wMonster][4][4] > 3 then
  484.                   set the member of sprite wSprite to monName1 & "2"
  485.                 end if
  486.               end if
  487.               if monsterData[wMonster][4][1] < 10 then
  488.                 monsterData[wMonster][4][1][2] = monsterData[wMonster][4][1][2] + 1
  489.               end if
  490.               floorTest = checkSolidpoint(curLoc + point(0, 50))
  491.               if floorTest[1] = 1 then
  492.                 if playerLocData[3][1] < curLoc[1] then
  493.                   monsterData[wMonster][4][1][1] = 0 - abs(monsterData[wMonster][4][1][1])
  494.                 else
  495.                   monsterData[wMonster][4][1][1] = abs(monsterData[wMonster][4][1][1])
  496.                 end if
  497.                 standBlock = monsterData[wMonster][3][2]
  498.               end if
  499.             else
  500.               removeEnemy = 0
  501.               existingBlock = curLoc[2] / 50
  502.               newLandLoc = (existingBlock * 50) + 25
  503.               monsterData[wMonster][4][4] = monsterData[wMonster][4][4] + 1
  504.               if monsterData[wMonster][4][4] > 9 then
  505.                 monsterData[wMonster][4][4] = 1
  506.               end if
  507.               if monsterData[wMonster][4][4] > 6 then
  508.                 set the member of sprite wSprite to monName2 & "1"
  509.               else
  510.                 if monsterData[wMonster][4][4] > 3 then
  511.                   set the member of sprite wSprite to monName2 & "2"
  512.                 else
  513.                   set the member of sprite wSprite to monName2 & "3"
  514.                 end if
  515.               end if
  516.               killTest1 = checkSolidpoint(curLoc + point(20, 0))
  517.               killtest2 = checkSolidpoint(curLoc + point(-20, 0))
  518.               if (killTest1[1] = 1) and (killtest2[1] = 1) then
  519.                 removeEnemy = 1
  520.               end if
  521.               if moveSpeed[2] > 0 then
  522.                 monsterData[wMonster][3][2] = monsterData[wMonster][3][2] - (monsterData[wMonster][3][2] mod screenTileSize) + integer(screenTileSize / 2.0) + 10
  523.                 monsterData[wMonster][4][1][2] = 0
  524.               else
  525.                 if moveSpeed[1] > 0 then
  526.                   solidTest = checkSolidpoint(curLoc + point(20, 20))
  527.                   walltest = checkSolidpoint(curLoc + point(20, 0))
  528.                   if jumpCliffs = 1 then
  529.                     solidTest = [1, 0]
  530.                   end if
  531.                   if (solidTest[1] = 0) or (walltest[1] = 1) then
  532.                     monsterData[wMonster][4][1][1] = 0 - abs(moveSpeed[1])
  533.                   end if
  534.                   monsterFlip = 1
  535.                 else
  536.                   if moveSpeed[1] < 0 then
  537.                     solidTest = checkSolidpoint(curLoc + point(-20, 20))
  538.                     walltest = checkSolidpoint(curLoc + point(-20, 0))
  539.                     if jumpCliffs = 1 then
  540.                       solidTest = [1, 0]
  541.                     end if
  542.                     if (solidTest[1] = 0) or (walltest[1] = 1) then
  543.                       monsterData[wMonster][4][1][1] = abs(moveSpeed[1])
  544.                     end if
  545.                     monsterFlip = 0
  546.                   else
  547.                     monsterData[wMonster][4][1][1] = abs(4)
  548.                     monsterFlip = 0
  549.                   end if
  550.                 end if
  551.               end if
  552.               moveSpeed[2] = 0
  553.             end if
  554.             driftSpd = monsterData[wMonster][4][2]
  555.             driftMoment = monsterData[wMonster][4][3]
  556.             repeat with wvect = 1 to 2
  557.               if driftSpd[wvect] > 0 then
  558.                 driftMoment[wvect] = driftMoment[wvect] - 1
  559.                 next repeat
  560.               end if
  561.               driftMoment[wvect] = driftMoment[wvect] + 1
  562.             end repeat
  563.             driftSpd = driftSpd + driftMoment
  564.             monsterData[wMonster][4][2] = driftSpd
  565.             monsterData[wMonster][4][3] = driftMoment
  566.             monsterData[wMonster][3] = monsterData[wMonster][3] + moveSpeed
  567.             if findDistance(playerViewpoint + point(290, 220), curLoc) > 500 then
  568.               removeEnemy = 1
  569.             else
  570.               if (curLoc[2] / 50) >= 10 then
  571.                 removeEnemy = 1
  572.               end if
  573.             end if
  574.             if spawnedMinion = 0 then
  575.               removeEnemy = 0
  576.             end if
  577.             if monsterData[wMonster][5] >= 1 then
  578.               addScore(25)
  579.               set the loc of sprite (monsterSO + wMonster) to point(-50, -50)
  580.               rpoint = monsterData[wMonster][3]
  581.               addparticle(rpoint, 0, 1)
  582.               monsterData[wMonster][1] = 0
  583.               repeat with wCoin = 1 to 1
  584.               end repeat
  585.             else
  586.               if removeEnemy = 1 then
  587.                 monsterData[wMonster][1] = 0
  588.                 set the loc of sprite (monsterSO + wMonster) to point(-50, -50)
  589.               else
  590.                 set the loc of sprite wSprite to monsterData[wMonster][3] - playerViewpoint + point(0, -5) + rumbleOffset
  591.                 sprite(wSprite).flipH = monsterFlip
  592.                 curLoc = monsterData[wMonster][3]
  593.                 add(monsterHitArea, rect(curLoc[1] - 25, curLoc[2] - 25, curLoc[1] + 25, curLoc[2] + 25))
  594.                 add(monsterHarmArea, rect(curLoc[1] - 10, curLoc[2] - 10, curLoc[1] + 20, curLoc[2] + 20))
  595.               end if
  596.             end if
  597.           5:
  598.             curLoc = monsterData[wMonster][3]
  599.             driftSpd = monsterData[wMonster][4][2]
  600.             driftMoment = monsterData[wMonster][4][3]
  601.             repeat with wvect = 1 to 2
  602.               if driftSpd[wvect] > 0 then
  603.                 driftMoment[wvect] = driftMoment[wvect] - 1
  604.                 next repeat
  605.               end if
  606.               driftMoment[wvect] = driftMoment[wvect] + 1
  607.             end repeat
  608.             driftSpd = driftSpd + driftMoment
  609.             monsterData[wMonster][4][2] = driftSpd
  610.             monsterData[wMonster][4][3] = driftMoment
  611.             set the member of sprite wSprite to "Trampoline"
  612.             set the loc of sprite wSprite to monsterData[wMonster][3] + driftSpd - playerViewpoint + rumbleOffset
  613.             sprite(wSprite).flipH = monsterFlip
  614.             curLoc = monsterData[wMonster][3] + driftSpd
  615.             add(monsterHitArea, rect(curLoc[1] - 25, curLoc[2] - 25, curLoc[1] + 25, curLoc[2] + 25))
  616.             add(monsterHarmArea, rect(curLoc[1] - 15, curLoc[2] - 15, curLoc[1] + 15, curLoc[2] + 15))
  617.           6:
  618.             curLoc = monsterData[wMonster][3]
  619.             moveSpeed = monsterData[wMonster][4][2]
  620.             floorTest = checkSolidpoint(curLoc + point(0, 20))
  621.             if curLoc[1] > (playerLocData[3][1] + 200) then
  622.               moveSpeed = moveSpeed - 1
  623.               if moveSpeed < -20 then
  624.                 moveSpeed = -20
  625.               end if
  626.             else
  627.               if curLoc[1] < (playerLocData[3][1] - 50) then
  628.                 moveSpeed = moveSpeed + 1
  629.                 if moveSpeed > 20 then
  630.                   moveSpeed = 20
  631.                 end if
  632.               end if
  633.             end if
  634.             monsterData[wMonster][3] = monsterData[wMonster][3] + point(moveSpeed, 0)
  635.             monsterData[wMonster][4][2] = moveSpeed
  636.             if monsterData[wMonster][4][1] > 0 then
  637.               monsterData[wMonster][4][1] = monsterData[wMonster][4][1] - 1
  638.             else
  639.               monsterData[wMonster][4][1] = 60 + random(20)
  640.               addMonster(4, curLoc, [point(4, 4), point(0, 4), point(0, 0), 0], 1)
  641.             end if
  642.             if (monsterData[wMonster][4][1] <= 25) and ((monsterData[wMonster][4][1] mod 3) <> 0) then
  643.               set the member of sprite wSprite to "Cloud2"
  644.             else
  645.               set the member of sprite wSprite to "Cloud1"
  646.             end if
  647.             set the loc of sprite wSprite to monsterData[wMonster][3] - playerViewpoint + rumbleOffset
  648.             add(monsterHitArea, rect(0, 0, 0, 0))
  649.             add(monsterHarmArea, rect(0, 0, 0, 0))
  650.             if playerLocData[3][1] > (90 * 40) then
  651.               addparticle(curLoc, 0, 7)
  652.               repeat with wBolt = 1 to 20
  653.                 rAim = 360 / 20 * wBolt
  654.                 locY = integer(cos(rAim * PI / 180) * -5)
  655.                 locX = integer(sin(rAim * PI / 180) * 25)
  656.                 addMonster(7, curLoc, [0, point(locX, locY), point(0, 0), 0], 2)
  657.               end repeat
  658.               monsterData[wMonster][2] = 10
  659.               playSound("Boss Hit SFX")
  660.             end if
  661.           7:
  662.             curLoc = monsterData[wMonster][3]
  663.             moveSpeed = monsterData[wMonster][4][2]
  664.             floorTest = checkSolidpoint(curLoc + point(0, 20))
  665.             monsterData[wMonster][4][2] = monsterData[wMonster][4][2] + point(0, 1)
  666.             monsterData[wMonster][3] = monsterData[wMonster][3] + moveSpeed
  667.             hitFloor = checkSolidpoint(curLoc + point(0, 20))
  668.             if monsterData[wMonster][4][1] > 0 then
  669.               monsterData[wMonster][4][1] = monsterData[wMonster][4][1] - 1
  670.             else
  671.               monsterData[wMonster][4][1] = 2
  672.             end if
  673.             if hitFloor[1] = 1 then
  674.               punchBlock(monsterData[wMonster][3] + point(0, 25))
  675.               monsterData[wMonster][1] = 0
  676.               set the loc of sprite wSprite to point(-50, -50)
  677.             else
  678.               if (monsterData[wMonster][4][1] <= 25) and ((monsterData[wMonster][4][1] mod 3) <> 0) then
  679.                 set the member of sprite wSprite to "Lightning1"
  680.               else
  681.                 set the member of sprite wSprite to "Lightning2"
  682.               end if
  683.               set the loc of sprite wSprite to monsterData[wMonster][3] - playerViewpoint + rumbleOffset
  684.               add(monsterHitArea, rect(0, 0, 0, 0))
  685.               add(monsterHarmArea, rect(curLoc[1] - 15, curLoc[2] - 15, curLoc[1] + 15, curLoc[2] + 15))
  686.             end if
  687.           8:
  688.             curLoc = monsterData[wMonster][3]
  689.             floorTest = checkSolidpoint(curLoc + point(0, 20))
  690.             if floorTest[1] = 1 then
  691.               existingBlock = curLoc[2] / 50
  692.               newLandLoc = (existingBlock * 50) + 25
  693.             end if
  694.           9:
  695.             curLoc = monsterData[wMonster][3]
  696.             floorTest = checkSolidpoint(curLoc + point(0, 20))
  697.             moveSpeed = monsterData[wMonster][4][1]
  698.             jumpDelay = monsterData[wMonster][4][2]
  699.             if monsterData[wMonster][4][4] > 0 then
  700.               monsterData[wMonster][5] = 0
  701.               monsterData[wMonster][4][4] = monsterData[wMonster][4][4] - 1
  702.               if monsterData[wMonster][4][4] > 0 then
  703.                 set the foreColor of sprite (monsterSO + wMonster) to random(255)
  704.               else
  705.                 set the foreColor of sprite (monsterSO + wMonster) to 255
  706.               end if
  707.             else
  708.               if monsterData[wMonster][5] > 0 then
  709.                 monsterData[wMonster][4][3] = monsterData[wMonster][4][3] + 1
  710.                 monsterData[wMonster][5] = 0
  711.                 if monsterData[wMonster][4][3] < 2 then
  712.                   monsterData[wMonster][4][4] = 20
  713.                 end if
  714.                 monsterData[wMonster][4][1][1] = 0
  715.                 monsterData[wMonster][4][1][2] = abs(monsterData[wMonster][4][1][2])
  716.               end if
  717.             end if
  718.             if monsterData[wMonster][5] >= 1 then
  719.             end if
  720.             if (monsterData[wMonster][4][2] < 0) or (floorTest[1] = 1) then
  721.               monsterData[wMonster][4][1][2] = monsterData[wMonster][4][1][2] + 1
  722.               if monsterData[wMonster][4][1][2] < 0 then
  723.                 celingTest = checkSolidpoint(monsterData[wMonster][3] - point(0, 20))
  724.                 if celingTest[1] = 1 then
  725.                   monsterData[wMonster][4][1][2] = abs(monsterData[wMonster][4][1][2])
  726.                 end if
  727.               end if
  728.               if monsterData[wMonster][4][1][1] > 0 then
  729.                 hitWall = checkSolidpoint(curLoc + point(20, 0))
  730.                 if hitWall[1] = 1 then
  731.                   monsterData[wMonster][4][1][1] = 0 - abs(monsterData[wMonster][4][1][1])
  732.                 end if
  733.               else
  734.                 hitWall = checkSolidpoint(curLoc - point(20, 0))
  735.                 if hitWall[1] = 1 then
  736.                   monsterData[wMonster][4][1][1] = abs(monsterData[wMonster][4][1][1])
  737.                 end if
  738.               end if
  739.               monsterData[wMonster][3] = monsterData[wMonster][3] + monsterData[wMonster][4][1]
  740.               floorTest = checkSolidpoint(monsterData[wMonster][3] + point(0, 20))
  741.               if floorTest[1] = 1 then
  742.                 monsterData[wMonster][4][2] = 10
  743.                 wDir = random(2)
  744.                 monsterData[wMonster][4][1] = point([3, -3][wDir], -15)
  745.                 case wDir of
  746.                   1:
  747.                     sprite(wSprite).flipH = 1
  748.                   2:
  749.                     sprite(wSprite).flipH = 0
  750.                 end case
  751.                 existingBlock = curLoc[2] / 50
  752.                 newLandLoc = (existingBlock * 50) + 25
  753.                 monsterData[wMonster][3][2] = newLandLoc
  754.               end if
  755.             else
  756.               if monsterData[wMonster][4][4] <= 0 then
  757.                 monsterData[wMonster][4][2] = monsterData[wMonster][4][2] - 1
  758.               end if
  759.               if monsterData[wMonster][4][2] <= 0 then
  760.               end if
  761.             end if
  762.             if (monsterData[wMonster][4][3] >= 2) and (monsterData[wMonster][4][4] <= 0) then
  763.               addScore(60)
  764.               set the loc of sprite (monsterSO + wMonster) to point(-50, -50)
  765.               addparticle(monsterData[wMonster][3], 0, 1)
  766.               monsterData[wMonster][1] = 0
  767.               addPickup(1, 2, monsterData[wMonster][3], point(0, 5 - random(3)))
  768.               playSound("Small Bomb SFX")
  769.             else
  770.               set the member of sprite wSprite to "foot_eye1"
  771.               set the loc of sprite wSprite to monsterData[wMonster][3] - playerViewpoint + rumbleOffset
  772.             end if
  773.             if monsterData[wMonster][4][4] <= 0 then
  774.               add(monsterHitArea, rect(curLoc[1] - 25, curLoc[2] - 15, curLoc[1] + 25, curLoc[2] + 10))
  775.               add(monsterHarmArea, rect(curLoc[1] - 15, curLoc[2] - 15, curLoc[1] + 15, curLoc[2] + 15))
  776.             else
  777.               add(monsterHitArea, rect(0, 0, 0, 0))
  778.               add(monsterHarmArea, rect(0, 0, 0, 0))
  779.             end if
  780.           10:
  781.             curLoc = monsterData[wMonster][3]
  782.             moveSpeed = monsterData[wMonster][4][2]
  783.             floorTest = checkSolidpoint(curLoc + point(0, 20))
  784.             if curLoc[1] > (playerLocData[3][1] + 100) then
  785.               moveSpeed = moveSpeed - 1
  786.               if moveSpeed < -12 then
  787.                 moveSpeed = -12
  788.               end if
  789.             else
  790.               if curLoc[1] < (playerLocData[3][1] - 100) then
  791.                 moveSpeed = moveSpeed + 1
  792.                 if moveSpeed > 12 then
  793.                   moveSpeed = 12
  794.                 end if
  795.               end if
  796.             end if
  797.             monsterData[wMonster][3] = monsterData[wMonster][3] + point(moveSpeed, 0)
  798.             monsterData[wMonster][4][2] = moveSpeed
  799.             if monsterData[wMonster][4][1] > 0 then
  800.               monsterData[wMonster][4][1] = monsterData[wMonster][4][1] - 1
  801.             else
  802.               monsterData[wMonster][4][1] = 4
  803.               addMonster(7, curLoc, [point(4, 10), point(0, 4), point(0, 0), 0], 2)
  804.             end if
  805.             if (monsterData[wMonster][4][1] <= 25) and ((monsterData[wMonster][4][1] mod 3) <> 0) then
  806.               set the member of sprite wSprite to "AngryCloud2"
  807.             else
  808.               set the member of sprite wSprite to "AngryCloud1"
  809.             end if
  810.             set the loc of sprite wSprite to monsterData[wMonster][3] - playerViewpoint + rumbleOffset
  811.             add(monsterHitArea, rect(0, 0, 0, 0))
  812.             add(monsterHarmArea, rect(0, 0, 0, 0))
  813.         end case
  814.       else
  815.         add(monsterHitArea, rect(0, 0, 0, 0))
  816.         add(monsterHarmArea, rect(0, 0, 0, 0))
  817.       end if
  818.       next repeat
  819.     end if
  820.     add(monsterHitArea, rect(0, 0, 0, 0))
  821.     add(monsterHarmArea, rect(0, 0, 0, 0))
  822.   end repeat
  823. end
  824.